Skip to content

Conversation

@ChAoSUnItY
Copy link
Collaborator

To prevent redefinition or serving other purposes, we sometimes need to negate the result of defined, however, currently shecc does support neither negation operator in macro scope, e.g. !defined(SOME_MACRO), nor #ifndef. Thus, in this PR, we introduce preprocessor directive #ifndef to solve this issue without massively refactoring frontend codebase (since frontend refactoring is WIP).

@jserv jserv merged commit c0bbf58 into sysprog21:master Nov 7, 2024
4 checks passed
@jserv
Copy link
Collaborator

jserv commented Nov 7, 2024

Thank @ChAoSUnItY for contributing!

ChAoSUnItY added a commit to ChAoSUnItY/shecc that referenced this pull request Apr 17, 2025
Previously in PR sysprog21#158, #ifndef is not sufficient enough to address
optional file inclusion issue in shecc, since shecc currently includes
file before tokenization / parsing pass. Therefore, "#pragma once" is
the only way to prevent recursively file inclusion.

Although "#pragma once" is not standard anywhere in C standards, major
C compilers such as GCC and Clang do support this preprocessor
directive.
ChAoSUnItY added a commit to ChAoSUnItY/shecc that referenced this pull request Apr 17, 2025
Previously in PR sysprog21#158, #ifndef is not sufficient enough to address
optional file inclusion issue in shecc, since shecc currently includes
file before tokenization / parsing pass. Therefore, "#pragma once" is
the only way to prevent recursively file inclusion.

Although "#pragma once" is not standard anywhere in C standards, major
C compilers such as GCC and Clang do support this preprocessor
directive.
ChAoSUnItY added a commit to ChAoSUnItY/shecc that referenced this pull request Apr 17, 2025
Previously in PR sysprog21#158, #ifndef is not sufficient enough to address
optional file inclusion issue in shecc, since shecc currently includes
file before tokenization / parsing pass. Therefore, "#pragma once" is
the only way to prevent recursively file inclusion.

Although "#pragma once" is not standard anywhere in C standards, major
C compilers such as GCC and Clang do support this preprocessor
directive.
ChAoSUnItY added a commit to ChAoSUnItY/shecc that referenced this pull request Apr 19, 2025
Previously in PR sysprog21#158, #ifndef is not sufficient enough to address
optional file inclusion issue in shecc, since shecc currently includes
file before tokenization / parsing pass. Therefore, "#pragma once" is
the only way to prevent recursively file inclusion.

Although "#pragma once" is not standard anywhere in C standards, major
C compilers such as GCC and Clang do support this preprocessor
directive.
ChAoSUnItY added a commit to ChAoSUnItY/shecc that referenced this pull request Apr 22, 2025
Previously in PR sysprog21#158, #ifndef is not sufficient enough to address
optional file inclusion issue in shecc, since shecc currently includes
file before tokenization / parsing pass. Therefore, "#pragma once" is
the only way to prevent recursively file inclusion.

Although "#pragma once" is not standard anywhere in C standards, major
C compilers such as GCC and Clang do support this preprocessor
directive.
ChAoSUnItY added a commit to ChAoSUnItY/shecc that referenced this pull request Apr 22, 2025
Previously in PR sysprog21#158, #ifndef is not sufficient enough to address
optional file inclusion issue in shecc, since shecc currently includes
file before tokenization / parsing pass. Therefore, "#pragma once" is
the only way to prevent recursively file inclusion.

Although "#pragma once" is not standard anywhere in C standards, major
C compilers such as GCC and Clang do support this preprocessor
directive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants